from peewee import *

from bitget.dynamic_model_base import create_dynamic_model


def create_k_line_model(name):
    # 定义字段
    fields = {
        'plat': CharField(),
        'inst_id': CharField(),
        'ts': CharField(),
        'o': CharField(),
        'h': CharField(),
        'l': CharField(),
        'c': CharField(),
        'create_time': DateTimeField()
    }
    unique_indexes = [('plat', 'inst_id', 'ts')]
    # 动态创建名为name的表和对应的实体类
    return create_dynamic_model(name, fields, unique_indexes)
